import axios from 'axios'

const axiosInstance = axios.create({
  baseURL: '/api',
  timeout: 5000
})

axiosInstance.interceptors.request.use(
  config =>{
    return config
  },
  error =>{
    console.log(error)
    Promise.reject(error)
  }
)

axiosInstance.interceptors.response.use(
  res => {
    return res.data
  },
  error => {
    console.log(error)
    Promise.reject(error)
  }
)

export default axiosInstance
